﻿using Loxodon.Framework.Binding;
using Loxodon.Framework.Contexts;
using Loxodon.Framework.Services;

namespace Master.Example.LoxodonFramework
{
    public class App
    {

        public static IServiceContainer Container
        {
            get
            {
                if (mContainer == null)
                {
                    mContainer = Context.GetApplicationContext().GetContainer();
                    
                    Init(mContainer);
                }

                return mContainer;
            }
        }

        private static IServiceContainer mContainer;


        static void Init(IServiceContainer container)
        {
            // 开启绑定服务
            new BindingServiceBundle(container)
                .Start();
            
            // 注册模型
            container.Register(new Model());
        }
    }
}